﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using MvcApplication1.Models;

namespace MvcApplication1.Controllers
{
    public class MenuController : ApiController
    {
       
        public HttpResponseMessage Get()
        {
            List<mon> a = new List<mon> { 
                new mon(){ma_mon=1,ten_mon="Lẩu thái",don_vi_tinh="cái",gia=100000},
                new mon(){ma_mon=2,ten_mon="Mực xào",don_vi_tinh="dĩa",gia=100000},
                 new mon(){ma_mon=3,ten_mon="Cơm chiên Dương Châu",don_vi_tinh="dĩa",gia=100000},
                new mon(){ma_mon=4,ten_mon="Bia",don_vi_tinh="chai",gia=100000}
            };

            string data = "{\"Result\":\"OK\",\"TotalRecordCount\":4,\"Records\":";
            //string data = "{\"total\":4,\"rows\":";
            data += a.ToJSON();
            data += "}";
            var response = this.Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent(data, Encoding.UTF8, "application/json");
            
            return response;
        }
    }
        
        
}
